<?php

class Mageex_Robot_Block_Adminhtml_Robot_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
{

  public function __construct()
  {
      parent::__construct();
      $this->setId('robot_tabs');
      $this->setDestElementId('edit_form');
      $this->setTitle(Mage::helper('robot')->__('Robot Information'));
  }

  protected function _beforeToHtml()
  {
		if( Mage::registry('robot_data') && Mage::registry('robot_data')->getId() ) {
			$type = Mage::registry('robot_data')->getType();
		}else{
			$type = Mage::registry('robot_type');
		}
		
		$block = strtolower($type);
		$content = $this->getLayout()->createBlock('robot/adminhtml_robot_edit_tab_' . $block)->toHtml();
		
		$this->addTab('form_amazon', array(
          'label'     => Mage::helper('robot')->__($type . ' Information'),
          'title'     => Mage::helper('robot')->__($type . ' Information'),
          'content'   => $content,
      ));
	  $this->addTab('form_template', array(
          'label'     => Mage::helper('robot')->__('Templates'),
          'title'     => Mage::helper('robot')->__('Templates'),
          'content'   => $this->getLayout()->createBlock('robot/adminhtml_robot_edit_tab_templates')->toHtml(),
      ));
      $this->addTab('form_section', array(
          'label'     => Mage::helper('robot')->__('Campaign Information'),
          'title'     => Mage::helper('robot')->__('Campaign Information'),
          'content'   => $this->getLayout()->createBlock('robot/adminhtml_robot_edit_tab_form')->toHtml(),
      ));
     
      return parent::_beforeToHtml();
  }
}